package com.ruoyi.gams.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.gams.mapper.GamsDepartmentMapper;
import com.ruoyi.gams.domain.GamsDepartment;
import com.ruoyi.gams.service.IGamsDepartmentService;

/**
 * 部门Service业务层处理
 *
 * @author ruoyi
 * @date 2021-09-03
 */
@Service
public class GamsDepartmentServiceImpl implements IGamsDepartmentService
{
    @Autowired
    private GamsDepartmentMapper gamsDepartmentMapper;

    /**
     * 查询部门
     *
     * @param id 部门主键
     * @return 部门
     */
    @Override
    public GamsDepartment selectGamsDepartmentById(Integer id)
    {
        return gamsDepartmentMapper.selectGamsDepartmentById(id);
    }

    /**
     * 查询部门列表
     *
     * @param gamsDepartment 部门
     * @return 部门
     */
    @Override
    public List<GamsDepartment> selectGamsDepartmentList(GamsDepartment gamsDepartment)
    {
        return gamsDepartmentMapper.selectGamsDepartmentList(gamsDepartment);
    }

    /**
     * 新增部门
     *
     * @param gamsDepartment 部门
     * @return 结果
     */
    @Override
    public int insertGamsDepartment(GamsDepartment gamsDepartment)
    {
        gamsDepartment.setCreateTime(DateUtils.getNowDate());
        return gamsDepartmentMapper.insertGamsDepartment(gamsDepartment);
    }

    /**
     * 修改部门
     *
     * @param gamsDepartment 部门
     * @return 结果
     */
    @Override
    public int updateGamsDepartment(GamsDepartment gamsDepartment)
    {
        return gamsDepartmentMapper.updateGamsDepartment(gamsDepartment);
    }

    /**
     * 批量删除部门
     *
     * @param ids 需要删除的部门主键
     * @return 结果
     */
    @Override
    public int deleteGamsDepartmentByIds(Integer[] ids)
    {
        return gamsDepartmentMapper.deleteGamsDepartmentByIds(ids);
    }

    /**
     * 删除部门信息
     *
     * @param id 部门主键
     * @return 结果
     */
    @Override
    public int deleteGamsDepartmentById(Integer id)
    {
        return gamsDepartmentMapper.deleteGamsDepartmentById(id);
    }
}
